﻿Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls


Public Enum TipoMensagem
    Sucesso
    Erro
    Alerta
End Enum

Partial Public Class WebUserControl1
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Public Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        pnlReports.Visible = False
    End Sub

    Public Sub Initialize()
        pnlReports.Visible = False
    End Sub

    Public Sub FeedbackUserMessage(ByVal _texto As String, ByVal _op As TipoMensagem)

        Texto = _texto

        If _op.Equals(TipoMensagem.Sucesso) Then
            imgFeedback.ImageUrl = "~/icons/icon_ok.png"
            feedbackTable.Attributes("class") = "SuccessTD"
        ElseIf _op.Equals(TipoMensagem.Erro) Then
            imgFeedback.ImageUrl = "~/icons/icon_error.png"
            feedbackTable.Attributes("class") = "ErrorTD"
        ElseIf _op.Equals(TipoMensagem.Alerta) Then
            imgFeedback.ImageUrl = "~/icons/icon_alert.png"
            feedbackTable.Attributes("class") = "AlertTD"
        End If

        'Dar um feedback ao utilizador
        pnlReports.Visible = True

    End Sub


    Public Property Texto() As String
        Get
            Return lbl_message.Text
        End Get
        Set(ByVal value As String)
            lbl_message.Text = value.ToString()
        End Set
    End Property



    Public Property Visivel() As Boolean
        Get
            Return (pnlReports.Visible)
        End Get
        Set(ByVal value As Boolean)
            pnlReports.Visible = value
        End Set
    End Property

    Protected Sub lkbRemover_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lkbRemover.Click
        pnlReports.Visible = False
        pnlReports.UpdateAfterCallBack = True
    End Sub


End Class